home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Deutsche Edition 1
/
Deutsche Edition 1.iso
/
amok
/
061-070
/
amok63
/
m2ced
/
txt.lha
/
CED.mod
< prev
next >
Wrap
Text File
|
1991-11-13
|
3KB
|
139 lines
(**********************************************************************
:Program. CED.mod
:Contents. Communication with CED
:Author. Steffen Reith
:Address. Hessenstr. 64, D-8700 Wuerzburg
:Phone. None
:Copyright. Shareware
:Language. Modula-2
:Translator. M2Amiga A+L V3.2d
:Imports. ARP,req
:History. V1.0 1.June 1990
**********************************************************************)
(*$ StackParms:=FALSE Volatile:=FALSE CaseChk:=FALSE *)
(*$ StackChk:=FALSE RangeChk:=FALSE OverflowChk:=FALSE NilChk:=FALSE *)
IMPLEMENTATION MODULE CED;
FROM SYSTEM IMPORT ADR,ADDRESS,CAST;
FROM ExecD IMPORT MsgPort,MsgPortPtr,Message,Node,NodePtr,NodeType;
FROM ExecL IMPORT FindPort,PutMsg,WaitPort,Forbid,Permit,FreeMem;
FROM ARP IMPORT CreatePort,DeletePort,STRPTR;
FROM req IMPORT PathTypePtr;
CONST CEDPortName='rexx_ced';
TYPE CEDMsg=RECORD
cmNode:Message;
rfu1:LONGINT;
rfu2:LONGINT;
action:LONGINT;
result1:LONGINT;
result2:ADDRESS;
args:ARRAY [1..16] OF ADDRESS;
rfu7:LONGINT;
rfu8:LONGINT;
rfu9:LONGINT;
rfu10:LONGINT;
rfu11:LONGINT;
rfu12:LONGINT
END;
VAR Mes:CEDMsg;
PROCEDURE PutMsg2CED (Command:ARRAY OF CHAR):BOOLEAN;
VAR CEDMsgPort,Reply:MsgPortPtr;
BEGIN
Fehler:=ok;
CEDMsgPort:=FindPort(ADR(CEDPortName));
IF CEDMsgPort=NIL THEN
Fehler:=noCED;
RETURN FALSE
END;
Reply:=CreatePort(ADR('Aloha_CED'),0);
IF Reply=NIL THEN
Fehler:=noReply;
RETURN FALSE
END;
WITH Mes DO
args[1]:=ADR(Command);
cmNode.node.type:=message;
cmNode.length:=SIZE(CEDMsg);
action:=0;
result2:=0;
cmNode.replyPort:=Reply
END;
PutMsg(CEDMsgPort,ADR(Mes));
WaitPort(Reply);
DeletePort(Reply);
RETURN TRUE
END PutMsg2CED;
PROCEDURE TalkCED(Command:ARRAY OF CHAR):BOOLEAN;
CONST ResultFlag=020000H; (* 1L<<17 *)
VAR CEDMsgPort,Reply:MsgPortPtr;
BEGIN
Fehler:=ok;
CEDMsgPort:=FindPort(ADR(CEDPortName));
IF CEDMsgPort=NIL THEN
Fehler:=noCED;
RETURN FALSE
END;
Reply:=CreatePort(ADR('Aloha_CED'),0);
IF Reply=NIL THEN
Fehler:=noReply;
RETURN FALSE
END;
WITH Mes DO
args[1]:=ADR(Command);
cmNode.node.type:=message;
cmNode.length:=SIZE(CEDMsg);
action:=ResultFlag; (* Come on Result *)
result2:=0;
cmNode.replyPort:=Reply
END;
PutMsg(CEDMsgPort,ADR(Mes));
WaitPort(Reply);
DeletePort(Reply);
Status:=Mes.result2; (* Bei mir liefert der CED nicht immer *)
Ergeb:=CAST(LONGINT,Mes.result2); (* nullterminierte Strings zurueck !!! *)
RETURN TRUE
END TalkCED;
PROCEDURE KillString(Ptr:PathTypePtr);
TYPE LongPtr=POINTER TO LONGINT;
VAR Location:LongPtr;
BEGIN
IF Location#NIL THEN
Location:=ADDRESS(Ptr);
DEC(Location,SIZE(Location^));
FreeMem(Location,Location^)
END
END KillString;
BEGIN
Status:=NIL;
Ergeb:=0;
END CED.